package com.learn.use.myreconsituteproject.forgotpass;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

import com.learn.use.myreconsituteproject.R;
import com.learn.use.myreconsituteproject.mvp.BaseActivity;
import com.learn.use.myreconsituteproject.mvp.codebean.CodeBean;
import com.learn.use.myreconsituteproject.register.bean.RegisterNextBean;
import com.learn.use.myreconsituteproject.register.presenter.RgDataPresenter;
import com.learn.use.myreconsituteproject.register.view.RegisterView;
import com.learn.use.myreconsituteproject.util.RegulerUtils;
import com.learn.use.myreconsituteproject.util.SharedPreferencesUtil;
import com.learn.use.myreconsituteproject.util.ToastUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by 聪明一只哈 on 2018/9/13.
 * Time: 2018/9/13  8:37
 */
public class ForgetPassActivity extends BaseActivity<RegisterView, RgDataPresenter<RegisterView>> implements RegisterView {

    @BindView(R.id.image_forgot_login_pwd_setting_back)
    ImageView imageForgotLoginPwdSettingBack;
    @BindView(R.id.et_user_froget_cell_num)
    EditText etUserFrogetCellNum;
    @BindView(R.id.et_user_froget_check_code)
    EditText etUserFrogetCheckCode;
    @BindView(R.id.bt_user_froget_send_check_code)
    Button btUserFrogetSendCheckCode;
    @BindView(R.id.bt_user_froget_next)
    Button btUserFrogetNext;
    private String ase_simple;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forgetpass);
        ButterKnife.bind(this);
        ase_simple = SharedPreferencesUtil.getString(this, "ase_simple", "");


    }

    @Override
    protected RgDataPresenter<RegisterView> creatPresenter() {
        return new RgDataPresenter<>();
    }


    @Override
    public void showProgress() {

    }

    @Override
    public void dissProgress() {

    }

    @Override
    public void RegisteDatasSuccess(RegisterNextBean registerNextBean) {

    }

    @Override
    public void RegisteDatasFiled(String beanMessage) {

    }

    @Override
    public void getCodeData(CodeBean codeBean) {
        ToastUtils.showShortToast(this,codeBean.getMsg());

    }

    @Override
    public void getCodeError(String errormessage) {
        ToastUtils.showShortToast(this,errormessage);

    }

    @OnClick({R.id.bt_user_froget_send_check_code, R.id.bt_user_froget_next})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.bt_user_froget_send_check_code:

                String num = etUserFrogetCellNum.getText().toString().trim();
                if (num!=null&& !TextUtils.isEmpty(num)&& RegulerUtils.isMobile(num)){
                    mPresenter.getRecongCode(ase_simple,num);
                }else{
                    ToastUtils.showShortToast(this,"手机号格式不正确");
                }

                break;
            case R.id.bt_user_froget_next:
                break;
        }
    }
}
